package com.reins.bookstore.object;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.reins.bookstore.entity.User;
import com.reins.bookstore.entity.UserAuth;
import lombok.Data;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

/*
* 前端用户列表中需要显示的内容
 */

@Data
public class UserDTO {

    private Integer userId;
    private  Integer userType;
    private String username;
    private String nickname;
    private String email;
    private String address;
    private Integer banned;

    public UserDTO(){}
    // 用一个user和一个user_auth对UserDTO进行赋值，除了密码都可以传到前端
    public UserDTO(User user, UserAuth user_auth){
        this.userId = user.getUserId();
        this.userType = user_auth.getUserType();
        this.username = user_auth.getUsername();
        this.nickname = user.getNickname();
        this.email = user.getEmail();
        this.address = user.getAddress();
        this.banned = user_auth.getBanned();
    }
}
